package com.paipai.service;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.paipai.entity.Log;
import com.paipai.dao.LogMapper;

@Transactional
@Service
public class LogService {
	@Autowired
	private LogMapper logMapper;

	public LogMapper getLogMapper() {
		return logMapper;
	}

	/**
	 * 新增一条日志记录
	 * 
	 * @param map
	 * @return
	 */
	public Integer insertLog(HashMap<String, Object> map) {
		Log log = new Log();
		log.setFullname(map.get("methods").toString());
		log.setDescribe(map.get("description").toString());
		log.setUsername(map.get("username").toString());

		
		//log.setDate(Long.parseLong(map.get("executionTime").toString()));
		int row = logMapper.insert(log);
		return row;
	}

}